//
//  HBStringListViewController.m
//  HBLibary_Example
//
//  Created by Rambo on 2018/11/4.
//  Copyright © 2018年 Rambo. All rights reserved.
//

#import "HBStringListViewController.h"
#import "HBStringListView.h"
#import "UIColor+HBCategory.h"
#import "HBEdgeInsetsLabel.h"

@interface HBStringListViewController ()

@end

@implementation HBStringListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    HBEdgeInsetsLabel *label = [[HBEdgeInsetsLabel alloc] init];
    label.textColor = [UIColor blackColor];
    label.text = @"测试";
    label.frame = CGRectMake(10, 66, 100, 30);
    label.edgeInsets = UIEdgeInsetsMake(6, 6, 6, 6);
    label.backgroundColor = [UIColor hb_colorWithHexString:@"0xf5f5f5"];
    [self.view addSubview:label];
    
    
    HBStringListView *listView = [[HBStringListView alloc] init];
    listView.tapBlock = ^(NSString *string, NSInteger index) {
        NSLog(@"点击--%@--%zd",string, index);
    };
//    listView.backgroundColor = [UIColor greenColor];
    listView.contentInsets = UIEdgeInsetsMake(12, 12, 12, 12);
//    listView.stringInsets = UIEdgeInsetsMake(6, 6, 6, 6 );
    listView.minimumLineSpacing = 6;
    listView.minimumInteritemSpacing = 10;
    listView.stringBackgroundColor = [UIColor hb_colorWithHexString:@"0xf5f5f5"];
    listView.radius = 3;
    listView.textColor = [UIColor hb_colorWithHexString:@"0x333333"];
//    listView.numberOfLines = 3;
    NSMutableArray *list = [NSMutableArray array];
    for (NSInteger index = 100; index < 120; index++) {
        NSString *string = [NSString stringWithFormat:@"标签%zd",index];
        if (index % 5 == 0) {
            string = @"这是一个长标签这是一个长标签这是一个长标签这是一个长标签这是一个长标签这是一个长标签";
        }
        if (index % 7 == 0) {
            string = @"1234567890123456789012345678901234567890123456789012345678901234567890";
        }
        
        if (index % 9 == 0) {
            string = @"擅长：@1111111111111111111111111111111111三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行三行";
        }
        [list addObject:string];
    }
    listView.titles = list;
    CGSize size = [listView sizeThatFits:CGSizeZero];
    listView.frame = CGRectMake(0, 100, size.width, size.height);
    [self.view addSubview:listView];
}

@end
